<?php
if (false)$category_list = new ORM_Category_Data_List();
?>
<table class="mainTable">
    <tr>
        <th colspan="2">列表设置</th>
    </tr>
    <tr>
        <td class="td1" align="right" width="20%">是否启用列表功能：</td>
        <td>
            <label><?php echo Form::radio('data[list][use]',1,$category_list->use===0?false:true,array('id'=>'list_use_1','onclick'=>'use_list()'));?>使用</label>
            <label><?php echo Form::radio('data[list][use]',0,$category_list->use===0?false:true,array('id'=>'list_use_0','onclick'=>'use_list()'));?>不使用</label>
        </td>
    </tr>
    <tbody id="list_div">
    <tr>
        <td width="100" class="td1" align="right">列表模板：</td>
        <td>
        <?php echo Form::select('data[list][tpl]',array('default'=>'默认'),$category_list->tpl);?>
        </td>
    </tr>
    <tr>
        <td class="td1" align="right">每页显示数：</td>
        <td>
        <?php echo Form::input('data[list][limit]',$category_list->limit?$category_list->limit:30, array('size'=>4));?>
        </td>
    </tr>
    <tr>
        <td class="td1" align="right">分页页码上限：</td>
        <td>
        <?php echo Form::input('data[list][maxpage]',$category_list->maxpage?$category_list->maxpage:0, array('size'=>4,'title'=>'超过此分页的列表将不被访问，0表示不限制'));?>
        </td>
    </tr>
    <tr>
        <td class="td1" align="right">排序方式：</td>
        <td>
        <select>
            <option value="create_time">创建时间</option>
        </select>
        <select name="class[list_orderby]">
            <option value="DESC">倒序排序</option>
            <option value="ASC">顺序排序</option>
        </select>
        </td>
    </tr>
    <tr>
        <td class="td1" align="right">输出方式：</td>
        <td>
        <label><?php echo Form::radio('data[list][tohtml]',1,$category_list->tohtml===1?true:false,array('id'=>'show_list_1','onclick'=>'show_list_output()'));?>生成静态列表页</label>
        <label><?php echo Form::radio('data[list][tohtml]',0,$category_list->tohtml===1?false:true,array('id'=>'show_list_2','onclick'=>'show_list_output()'));?>使用动态列表页</label>
        </td>
    </tr>
    <tr>
        <td class="td1" align="right">输出选项：</td>
        <td>
            <table class="mainTable" style="width:auto" id="list_output_div_1">
                <tr>
                    <td class="td1" align="right">文件名：</td>
                    <td>
                    <?php echo Form::input('data[list][filename]',$category_list->filename?$category_list->filename:'list_{{page}}.html',array('title'=>'页码用{{page}}代替，例如:list_{{page}}.html<br>指针用{{offset}}代替，例如:list_{{offset}}.html'));?>
                    </td>
                </tr>
                <tr>
                    <td class="td1" align="right">静态页上限：</td>
                    <td>
                    <?php echo Form::input('data[list][tohtml_maxpage]',$category_list->tohtml_maxpage?$category_list->tohtml_maxpage:'100',array('title'=>'超过上限页面将使用PHP动态输出，并缓存到重新生成列表页<br>0表示不限制。','size'=>4));?>
                    </td>
                </tr>
            </table>
            <table class="mainTable" style="width:auto" id="list_output_div_2">
                <tr>
                    <td class="td1" align="right">缓存时间：</td>
                    <td>
                    <?php echo Form::input('data[list][cache_time]',$category_list->cache_time?$category_list->cache_time:'0',array('size'=>4,'title'=>'单位：秒，0表示不缓存'));?>
                    </td>
                </tr>
            </table>
            <script type="text/javascript">
            function show_list_output()
            {
                var obj1 = MyQEE.$('list_output_div_1');
                var obj2 = MyQEE.$('list_output_div_2');
                if (MyQEE.$('show_list_1').checked)
                {
                    obj1.style.display = '';
                    obj2.style.display = 'none';
                }
                else
                {
                    obj1.style.display = 'none';
                    obj2.style.display = '';
                }
            }
            show_list_output();
            </script>
        </td>
    </tr>
    <?php
    foreach ( View::get_tag('cms.admin.category.form.list') as $item )
    {
    ?>
    <tr>
        <td class="td1" align="right"><?php $item->run(0);?></td>
        <td>
            <?php $item->run(1);?>
        </td>
    </tr>
    <?php
    }
    ?>
    </tbody>
</table>

<script type="text/javascript">
function use_list(){
    if ( MyQEE.$('list_use_0').checked )
    {
        MyQEE.$('list_div').style.display = 'none';
    }
    else
    {
        MyQEE.$('list_div').style.display = '';
    }
}
use_list();
</script>